home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume24 / psroff3.0 / part04 < prev    next >
Encoding:
Internet Message Format  |  1991-10-09  |  55.5 KB

  1. Subject:  v24i099:  psroff, Troff to PostScript filter, Part04/19
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: Chris Lewis <clewis@ferret.ocunix.on.ca>
  6. Posting-number: Volume 24, Issue 99
  7. Archive-name: psroff3.o/part04
  8.  
  9. #! /bin/sh
  10. # This is a shell archive.  Remove anything before this line, then feed it
  11. # into a shell via "sh file" or similar.  To overwrite existing files,
  12. # type "sh file -c".
  13. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  14. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  15. # Contents:  dit.c ps.c utils/maps/cmtrf.ROMAN8 utils/psdtwd.S
  16. # Wrapped by clewis@ecicrl on Fri Apr  5 20:55:58 1991
  17. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  18. echo If this archive is complete, you will see the following message:
  19. echo '          "shar: End of archive 4 (of 19)."'
  20. if test -f 'dit.c' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'dit.c'\"
  22. else
  23.   echo shar: Extracting \"'dit.c'\" \(11773 characters\)
  24.   sed "s/^X//" >'dit.c' <<'END_OF_FILE'
  25. X/*
  26. X    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  27. X        All Rights Reserved
  28. X
  29. X    See the LICENSE file for a full description of restrictions under which
  30. X    this software is provided.
  31. X
  32. X    Function:        ditroff frontend.
  33. X */
  34. X
  35. X#include "defs.h"
  36. X
  37. X#ifndef    lint
  38. Xstatic char SCCSid[] =
  39. X    "@(#)dit.c: 91/03/26 Copyright 91/03/26 00:13:12 Chris Lewis";
  40. X#endif
  41. X
  42. Xextern struct cattab tabN[], tabS[], *extidx;
  43. Xextern struct troff2befont *extchar;
  44. X
  45. X/*    Translation of single character characters to cattab
  46. X    entries and, hence, emittable strings via the backends.
  47. X */
  48. Xstruct cattab **dittab;
  49. X
  50. X/*    \(xx characters */
  51. Xstruct cattab **spctab, **ts;
  52. X
  53. Xstruct cattab *ditsearch(str)
  54. Xchar *str; {
  55. X    /* should do binary search */
  56. X    register int l, mid, h, k;
  57. X    l = 0;
  58. X    h = extcount - 1;
  59. X#ifdef    NEVER
  60. X    for (ts = spctab; *ts; ts++)
  61. X    if (strcmp((*ts)->ch_name, str) == 0)
  62. X        return(*ts);
  63. X#endif
  64. X    while(l <= h) {
  65. X    mid = (l + h) >> 1;
  66. X    k = strcmp(str, spctab[mid]->ch_name);
  67. X    if (k == 0)
  68. X        return(spctab[mid]);
  69. X    else if (k < 0)
  70. X        h = mid - 1;
  71. X    else
  72. X        l = mid + 1;
  73. X    }
  74. X    return((struct cattab *) NULL);
  75. X}
  76. X
  77. Xcatcmp(a, b)
  78. Xstruct cattab **a, **b; {
  79. X    return(strcmp((*a)->ch_name, (*b)->ch_name));
  80. X}
  81. X
  82. Xaddtab(table)
  83. Xstruct cattab *table; {
  84. X    register struct cattab *p;
  85. X    extern char *realloc();
  86. X
  87. X    for (p = table; p->ch_name != NOC; p++) {
  88. X    DBP((D_CAT, "Addtab: %s\n", p->ch_name));
  89. X    if (p->ch_desc != NOC && p->ch_catidx != NTC)
  90. X        if (strlen(p->ch_name) == 1)
  91. X        dittab[p->ch_name[0]] = p;
  92. X        else {
  93. X        DBP((D_CAT, "AddtabS: %s %d\n", p->ch_name, extcount));
  94. X        if (extcount > 0 && !(extcount%EXTCHUNK)) {
  95. X            spctab = (struct cattab **) realloc(spctab,
  96. X            sizeof(struct cattab *) * (extcount + EXTCHUNK + 1));
  97. X            clrarray(&spctab[extcount], sizeof(struct cattab *) *
  98. X            (EXTCHUNK+1));
  99. X        }
  100. X        spctab[extcount++] = p;
  101. X        }
  102. X    }
  103. X}
  104. X
  105. Xfixtab() {
  106. X    register int i;
  107. X    extern char *malloc();
  108. X
  109. X    dittab = (struct cattab **) mustmalloc(sizeof(struct cattab *) * 256,
  110. X    "dittab");
  111. X
  112. X    spctab = (struct cattab **) mustmalloc(sizeof(struct cattab *) *
  113. X    (EXTCHUNK+1), "spctab");
  114. X
  115. X    extcount = 0;
  116. X
  117. X    addtab(tabN);
  118. X    addtab(tabS);
  119. X    addtab(extidx);
  120. X
  121. X    /*    Magic */
  122. X    dittab['-'] = &tabN[31];
  123. X    dittab['_'] = &tabS[31];
  124. X
  125. X    DBP((D_CAT, "End addtab: %d characters\n", extcount));
  126. X
  127. X    spctab[extcount] = NULL;
  128. X
  129. X    DBP((D_CAT, "After NULL\n"));
  130. X
  131. X    if (debug&D_CAT) {
  132. X
  133. X    for (ts = spctab; *ts; ts++)
  134. X        DBP((D_CAT, "%s -> %08x (%d)\n", (*ts)->ch_name, *ts,
  135. X        (*ts)->ch_catidx));
  136. X
  137. X    }
  138. X
  139. X    qsort(spctab, extcount, sizeof (struct cattab *), catcmp);
  140. X
  141. X    DBP((D_CAT, "After qsort\n"));
  142. X
  143. X#ifdef DEBUG
  144. X    if (debug&D_CAT) {
  145. X
  146. X    for (ts = spctab; *ts; ts++)
  147. X        DBP((D_CAT, "%s -> %08x (%d)\n", (*ts)->ch_name, *ts,
  148. X        (*ts)->ch_catidx));
  149. X
  150. X    for (i = 0; i < 256; i++)
  151. X        if (dittab[i])
  152. X        DBP((D_CAT, "%d:%02x:%c: %d/%d\n", i, i, i, dittab[i]->ch_set,
  153. X        dittab[i]->ch_catidx));
  154. X    }
  155. X#endif
  156. X}
  157. X
  158. X#ifdef    DIT
  159. Xint indtres;
  160. X
  161. Xint points, font, ch, i;
  162. Xint xpos, ypos;
  163. X
  164. Xdit() {
  165. X    register int cmd, nc, i, j;
  166. X    register struct cattab *p;
  167. X    register struct cattab *last = (struct cattab *) NULL;
  168. X    char special[512];
  169. X    fixtab();
  170. X    DBP((D_CAT, "Finished fixtab\n"));
  171. X    while(1) {
  172. X    switch(cmd = skipwhite()) {
  173. X        case EOF:
  174. X        goto finish;
  175. X        case 's':
  176. X        points = getnum();
  177. X        DBP((D_CAT, "Pointsize %d\n", points));
  178. X        break;
  179. X        case 'f':
  180. X        font = getnum();
  181. X        if (font < 0 || font >= INTFONTS) {
  182. X            fprintf(stderr,
  183. X            "%s: font number %d too high - make INTFONTS bigger\n",
  184. X            progname, font);
  185. X            font = 1;
  186. X        } else if (font == 0)
  187. X            /* font 0 stuff - because I map font n to n-1 internally */
  188. X            font = INTFONTS - 1;
  189. X        else
  190. X            font--;
  191. X        DBP((D_CAT, "Font %d\n", font));
  192. X        break;
  193. X        case '0':
  194. X        case '1':
  195. X        case '2':
  196. X        case '3':
  197. X        case '4':
  198. X        case '5':
  199. X        case '6':
  200. X        case '7':
  201. X        case '8':
  202. X        case '9':
  203. X        xpos += (cmd - '0') * 10 + (getchar() - '0');
  204. X        /*fallthru*/
  205. X        case 'c':
  206. X        p = dittab[ch = (getchar()&0xff)];
  207. X        if (!p) {
  208. X            char seq[2];
  209. X
  210. X            if (ch == ' ')
  211. X            break;
  212. X            fprintf(stderr,
  213. X            "%s: don't know this character: 0x%02x(%c)\n",
  214. X            progname, ch, ch);
  215. X            seq[0] = ch;
  216. X            seq[1] = '\0';
  217. X            ditemit(xpos, ypos, font, points, 0, seq);
  218. X            break;
  219. X        }
  220. X        if (p->ch_wididx == NTC) /* extended character */
  221. X            ditemit(xpos, ypos,
  222. X            p->ch_set == N ? -font-1: -symidx-1,
  223. X            points, p->ch_catidx,
  224. X            extchars[p->ch_catidx].t2b_charseq);
  225. X        else
  226. X            ditemit(xpos, ypos,
  227. X            p->ch_set == N ? font: symidx,
  228. X            points, p->ch_catidx, (char *) NULL);
  229. X        break;
  230. X
  231. X        case 'u':        /* groff kern this sequence command */
  232. X        j = getnum();
  233. X        /* kern ignored for the moment - have to read the width
  234. X           table */
  235. X        /* fallthru */
  236. X        case 't':        /* groff sequence */
  237. X        { char ubuf[100];
  238. X            /* should really read the width tables and
  239. X               do each character individually, but for the
  240. X               moment, this should work reasonably well */
  241. X#ifdef    OPT
  242. X            canonflush();
  243. X#endif
  244. X            while((ch = getchar()) != EOF && isspace(ch));
  245. X            if (ch == EOF)
  246. X            break;
  247. X            ubuf[i++] = ch;
  248. X            while((ch = getchar()) != EOF && !isspace(ch))
  249. X            ubuf[i++] = ch;
  250. X            p = dittab[ubuf[0]&0xff];
  251. X            if (!p)
  252. X            ditemit(xpos, ypos, font, points, 0, ubuf);
  253. X            else if (p->ch_wididx == NTC)
  254. X            ditemit(xpos, ypos,
  255. X                p->ch_set == N ? -font-1: -symidx-1,
  256. X                points, 0, ubuf);
  257. X            else
  258. X            ditemit(xpos, ypos, p->ch_set == N ? font: symidx,
  259. X                points, 0, ubuf);
  260. X        }
  261. X        case 'C':
  262. X        i = 0;
  263. X        while((ch = getchar()) != EOF && !isspace(ch))
  264. X            special[i++] = ch;
  265. X        special[i] = '\0';
  266. X        if (last && strcmp(last->ch_name, special) == 0)
  267. X            p = last;
  268. X        else {
  269. X            p = ditsearch(special);
  270. X            last = p;
  271. X        }
  272. X        if (!p) {
  273. X            fprintf(stderr,
  274. X            "%s: don't know this character: %s\n", progname,
  275. X            special);
  276. X        } else {
  277. X            if (p->ch_wididx == NTC) /* extended character */
  278. X            ditemit(xpos, ypos,
  279. X                p->ch_set == N ? -font-1 : -symidx-1,
  280. X                points, p->ch_catidx,
  281. X                extchars[p->ch_catidx].t2b_charseq);
  282. X            else
  283. X            ditemit(xpos, ypos,
  284. X                p->ch_set == N ? font : symidx,
  285. X                points, p->ch_catidx, (char *) NULL);
  286. X            DBP((D_CAT, "Special %s\n", special));
  287. X        }
  288. X        break;
  289. X        case 'x':
  290. X        {
  291. X            char cmd[20], a1[20], a2[20], a3[20];
  292. X            int cnt;
  293. X            i = 0;
  294. X#ifdef    OPT
  295. X            canonflush();
  296. X#endif
  297. X            /* synchronize special X & Y to current position
  298. X               (ie: so psfig will work */
  299. X            specXPos = (int) ((long) xpos * TROFFRESOLUTION / indtres);
  300. X            specYPos = (int) ((long) ypos * TROFFRESOLUTION / indtres);
  301. X
  302. X            while((ch = getchar()) != EOF && isspace(ch));
  303. X            special[i++] = ch;
  304. X            while((ch = getchar()) != EOF && ch != '\n')
  305. X            special[i++] = ch;
  306. X            special[i] = '\0';
  307. X            DBP((D_CAT, "Command %s\n", special));
  308. X            i = sscanf(special, "%s %s %s %s", cmd, a1, a2, a3);
  309. X            if (i <= 0) {
  310. X            fprintf(stderr, "%s: bad x command: %s\n",
  311. X                progname, special);
  312. X            exit(1);
  313. X            }
  314. X            switch(cmd[0]) {
  315. X            case 'p':
  316. X            case 'H':
  317. X            case 'S':
  318. X                break;
  319. X            case 'f':    /* font load */
  320. X                if (i != 3) {
  321. X                fprintf(stderr, "%s: bad font command: %s\n",
  322. X                progname, special);
  323. X                exit(1);
  324. X                }
  325. X                sprintf(special, "F%s%s", a1, a2);
  326. X                DBP((D_CAT, "FONT %s %s\n", a1, a2));
  327. X                dospecial(special);
  328. X                break;
  329. X            case 'r':    /* specify resolution */
  330. X                if (i != 4) {
  331. X                fprintf(stderr, "%s: bad res command: %s\n",
  332. X                progname, special);
  333. X                exit(1);
  334. X                }
  335. X                indtres = atoi(a1);
  336. X                if (indtres <= 0) {
  337. X                if (i != 4) {
  338. X                    fprintf(stderr,
  339. X                    "%s: ridiculous res value: %s\n",
  340. X                    progname, special);
  341. X                    exit(1);
  342. X                }
  343. X                }
  344. X                DBP((D_CAT, "RES %d\n", indtres));
  345. X                break;
  346. X            case 'i':
  347. X                DBP((D_CAT, "INIT\n"));
  348. X                if (be->beprolog)
  349. X                (*be->beprolog)();
  350. X                resetState();
  351. X                break;
  352. X            case 't':
  353. X                DBP((D_CAT, "TRAILER\n"));
  354. X                break;
  355. X            case 's':
  356. X                DBP((D_CAT, "STOP\n"));
  357. X                return;
  358. X            case 'T':
  359. X                if (i != 2) {
  360. X                fprintf(stderr, "%s: bad x T command: %s\n",
  361. X                    progname, special);
  362. X                exit(1);
  363. X                }
  364. X                device = mustmalloc(strlen(a1) + 1, "device");
  365. X                strcpy(device, a1);
  366. X                DBP((D_CAT, "TYPE %s\n", a1));
  367. X                break;
  368. X            case 'X':
  369. X                switch(a1[0]) {
  370. X                case 'f':
  371. X                    a1[0] = 'I';
  372. X                    break;
  373. X                case 'p':
  374. X                    a1[0] = 'P';
  375. X                    break;
  376. X                }
  377. X                dospecial(a1);
  378. X                break;
  379. X
  380. X            default:
  381. X                fprintf(stderr, "%s: unknown special: %s\n",
  382. X                progname, special);
  383. X            }
  384. X        }
  385. X        break;
  386. X        case 'H':
  387. X        xpos = getnum();
  388. X        DBP((D_CAT, "Hor: %d\n", xpos));
  389. X        break;
  390. X        case 'h':
  391. X        xpos += getnum();
  392. X        DBP((D_CAT, "Hor (inc): %d\n", xpos));
  393. X        break;
  394. X        case 'V':
  395. X#ifdef    OPT
  396. X        canonflush();
  397. X#endif
  398. X        ypos = getnum();
  399. X        DBP((D_CAT, "Ver: %d\n", ypos));
  400. X        break;
  401. X        case 'v':
  402. X#ifdef    OPT
  403. X        canonflush();
  404. X#endif
  405. X        ypos += getnum();
  406. X        DBP((D_CAT, "Ver (inc): %d\n", ypos));
  407. X        break;
  408. X        break;
  409. X        case 'p':
  410. X        ch = getnum();
  411. X        DBP((D_CAT, "Page %d\n", ch));
  412. X        if (be->bepage)
  413. X            (*be->bepage)();
  414. X        break;
  415. X        case 'n':    /* end of line */
  416. X        ch = getnum();
  417. X        ch = skipwhite();
  418. X        ungetc(ch, stdin);
  419. X        ch = getnum();
  420. X        break;
  421. X        case 'i':    /* stipple? BERK */
  422. X        ch = getnum();
  423. X        break;
  424. X        case 'P':    /* split end? BERK */
  425. X        break;
  426. X        case 'w':
  427. X#ifdef    OPT
  428. X        canonflush();
  429. X#endif
  430. X        break;
  431. X        case '#':
  432. X        case 'D':
  433. X        case '!':
  434. X#ifdef    OPT
  435. X        canonflush();
  436. X#endif
  437. X        i = 1;
  438. X        special[0] = cmd;
  439. X        while((ch = getchar()) != EOF && isspace(ch));
  440. X        special[i++] = ch;
  441. X        while((ch = getchar()) != EOF && ch != '\n')
  442. X            special[i++] = ch;
  443. X        special[i] = '\0';
  444. X        DBP((D_CAT, "#/D/! %s\n", special));
  445. X
  446. X        switch(cmd) {
  447. X            case '#':
  448. X            break;
  449. X            case '!':
  450. X            special[0] = 'P';
  451. X            dospecial(xpos * TROFFRESOLUTION / indtres,
  452. X                     ypos * TROFFRESOLUTION / indtres,
  453. X                     special);
  454. X            break;
  455. X            case 'D': {
  456. X            short values[100];
  457. X            int opcode, ct, newx, newy;
  458. X
  459. X            if (!(opcode = drawparse(&ct, values, &special[1])))
  460. X                break;
  461. X            if (!strchr("lcCeEa~tfpP", opcode)) {
  462. X                fprintf(stderr, "%s: unknown draw code %s\n",
  463. X                progname, special);
  464. X                break;
  465. X            }
  466. X            newx = xpos;
  467. X            newy = ypos;
  468. X            if (opcode == 'e' || opcode == 'E')
  469. X                newx += values[0];
  470. X            else if (opcode != 't' && opcode != 'f') {
  471. X                for (i = 0; i < ct/2; i++) {
  472. X                newx += values[i*2];
  473. X                newy += values[i*2+1];
  474. X                }
  475. X                if (i*2 < ct)
  476. X                newx += values[i*2];
  477. X            }
  478. X            if (opcode != 't' && opcode != 'f')
  479. X                for (i = 0; i < ct; i++)
  480. X                values[i] = values[i] * TROFFRESOLUTION /
  481. X                            indtres;
  482. X
  483. XDBP((D_CAT, "Draw: xpos,ypos,opcode,ct,special = %d,%d,%d,%d,%s\n",
  484. X    xpos, ypos, opcode, ct, special));
  485. X
  486. X            if (be->bedraw)
  487. X                (be->bedraw)(xpos * TROFFRESOLUTION / indtres,
  488. X                     ypos * TROFFRESOLUTION / indtres,
  489. X                     opcode, ct, values, special);
  490. X            xpos = newx;
  491. X            ypos = newy;
  492. X            }
  493. X        }
  494. X        break;
  495. X    }
  496. X    }
  497. X    finish: ;
  498. X}
  499. X
  500. Xskipwhite() {
  501. X    int c;
  502. X    while((c = getchar()) != EOF && isspace(c));
  503. X    return(c);
  504. X}
  505. X
  506. Xgetnum() {
  507. X    register int ret = 0;
  508. X    int c;
  509. X    while((c = getchar()) != EOF && isdigit(c))
  510. X    ret = ret * 10 + (c - '0');
  511. X    ungetc(c, stdin);
  512. X    DBP((D_CAT, "Getnum: %d\n", ret));
  513. X    return(ret);
  514. X}
  515. X
  516. Xditemit(x, y, font, points, troffChar, sequence)
  517. Xint x, y;
  518. Xint font, points, troffChar;
  519. Xregister char *sequence; {
  520. X    DBP((D_CAT, "x,y: %d/%d -> ", x, y));
  521. X    x = (int) ((long) x * TROFFRESOLUTION / indtres);
  522. X    y = (int) ((long) y * TROFFRESOLUTION / indtres);
  523. X    DBP((D_CAT, "%d/%d (font,points,ch = %d,%d,%d)\n", x, y, font, points,
  524. X    troffChar));
  525. X#ifdef OPT
  526. X    if (sequence) {
  527. X    canonflush();
  528. X    if (be->beputchar)
  529. X        (*be->beputchar)(x, y, font, points, troffChar, sequence);
  530. X    } else
  531. X    canoninsert(x, y, font, points, troffChar);
  532. X#else
  533. X    if (be->beputchar)
  534. X    (*be->beputchar)(x, y, font, points, troffChar, sequence);
  535. X#endif
  536. X}
  537. X#endif
  538. END_OF_FILE
  539.   if test 11773 -ne `wc -c <'dit.c'`; then
  540.     echo shar: \"'dit.c'\" unpacked with wrong size!
  541.   fi
  542.   # end of 'dit.c'
  543. fi
  544. if test -f 'ps.c' -a "${1}" != "-c" ; then 
  545.   echo shar: Will not clobber existing file \"'ps.c'\"
  546. else
  547.   echo shar: Extracting \"'ps.c'\" \(19969 characters\)
  548.   sed "s/^X//" >'ps.c' <<'END_OF_FILE'
  549. X/*
  550. X    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  551. X        All Rights Reserved
  552. X
  553. X    See the LICENSE file for a full description of restrictions under which
  554. X    this software is provided.
  555. X
  556. X    Function:        PostScript driver
  557. X */
  558. X
  559. X#include "defs.h"
  560. X
  561. X#ifdef    PS
  562. X#include "ps.h"
  563. X
  564. X#ifndef    lint
  565. Xstatic char SCCSid[] =
  566. X    "@(#)ps.c: 2.12 Copyright 91/03/25 23:20:43 Chris Lewis";
  567. X#endif
  568. X
  569. X/*    ps.c will generate some additional "print" commands to cause
  570. X    the printer to "print" back who did the job, and how long it
  571. X    took.  define NOCHATTER if you don't want this.
  572. X */
  573. Xstatic long charCount;
  574. X
  575. X#ifdef    FORM
  576. Xstatic char Overlay[100] = {""};
  577. X#endif
  578. X
  579. X#define    USED    01
  580. X
  581. Xstruct troff2befont psStdFont[108] = {
  582. X
  583. X/*    Note on X-shift, Y-shift and point scale factor:
  584. X    The first two are shifts in the baseline position of the
  585. X    character, and the third is a multiplier of the point size.
  586. X    If they are zero, nothing happens.  If they are non-zero,
  587. X    they are first multiplied by .01, then (in the case of the
  588. X    shifts), multiplied by the current points to get a shift
  589. X    value in TROFF2PS[XY] coordinates.  In the case of point scale
  590. X    factor, it is multiplied by <currentpointsize> * .01 and becomes
  591. X    the pointsize of the sequence to be emitted.
  592. X */
  593. X/*          +-------------------------------- Troff character number
  594. X        |
  595. X            |    +--------------------------- N: standard fonts
  596. X            |    |                            S: symbol font
  597. X            |    |                            D: draw macro
  598. X            |    |                            n: new font
  599. X            |    |
  600. X            |    |  +------------------------ X-shift
  601. X            |    |  |                         Note: positive is right.
  602. X            |    |  |
  603. X            |    |  |  +--------------------- Y-shift
  604. X            |    |  |  |                      Note: positive is up.
  605. X            |    |  |  |
  606. X            |    |  |  |  +------------------ Point scale factor
  607. X            |    |  |  |  |
  608. X            |    |  |  |  |   +-------------- Sequence
  609. X            |    |  |  |  |   |
  610. X            v    v  v  v  v   v */
  611. X    /*  0*/    {N, 0, 0, 0, "h"},
  612. X    /*  1*/    {N, 0, 0, 0, "t"},
  613. X    /*  2*/    {N, 0, 0, 0, "n"},
  614. X    /*  3*/    {N, 0, 0, 0, "m"},
  615. X    /*  4*/    {N, 0, 0, 0, "l"},
  616. X    /*  5*/    {N, 0, 0, 0, "i"},
  617. X    /*  6*/    {N, 0, 0, 0, "z"},
  618. X    /*  7*/    {N, 0, 0, 0, "s"},
  619. X    /*  8*/    {N, 0, 0, 0, "d"},
  620. X    /*  9*/    {N, 0, 0, 0, "b"},
  621. X    /* 10*/    {N, 0, 0, 0, "x"},
  622. X    /* 11*/    {N, 0, 0, 0, "f"},
  623. X    /* 12*/    {N, 0, 0, 0, "j"},
  624. X    /* 13*/    {N, 0, 0, 0, "u"},
  625. X    /* 14*/    {N, 0, 0, 0, "k"},
  626. X    /* 15*/    {N, 0, 0, 0, NOC},
  627. X    /* 16*/    {N, 0, 0, 0, "p"},
  628. X    /* 17*/    {D, 0, 0, 0, "do34em"},
  629. X    /* 18*/    {N, 0, 0, 0, ";"},
  630. X    /* 19*/    {N, 0, 0, 0, NOC},
  631. X    /* 20*/    {N, 0, 0, 0, "a"},
  632. X    /* 21*/    {N, 0, 0, 0, "_"},
  633. X    /* 22*/    {N, 0, 0, 0, "c"},
  634. X    /* 23*/    {N, 0, 0, 0, "`"},
  635. X    /* 24*/    {N, 0, 0, 0, "e"},
  636. X    /* 25*/    {N, 0, 0, 0, "'"},
  637. X    /* 26*/    {N, 0, 0, 0, "o"},
  638. X    /* 27*/    {D, 0, 0, 0, "do14"},
  639. X    /* 28*/    {N, 0, 0, 0, "r"},
  640. X    /* 29*/    {D, 0, 0, 0, "do12"},
  641. X    /* 30*/    {N, 0, 0, 0, "v"},
  642. X    /* 31*/    {N, 0, 0, 0, "-"},
  643. X    /* 32*/    {N, 0, 0, 0, "w"},
  644. X    /* 33*/    {N, 0, 0, 0, "q"},
  645. X    /* 34*/    {N, 0, 0, 0, "/"},
  646. X    /* 35*/    {N, 0, 0, 0, "."},
  647. X    /* 36*/    {N, 0, 0, 0, "g"},
  648. X    /* 37*/    {D, 0, 0, 0, "do34"},
  649. X    /* 38*/    {N, 0, 0, 0, ","},
  650. X    /* 39*/    {N, 0, 0, 0, "&"},
  651. X    /* 40*/    {N, 0, 0, 0, "y"},
  652. X    /* 41*/    {N, 0, 0, 0, NOC},
  653. X    /* 42*/    {N, 0, 0, 0, "%"},
  654. X    /* 43*/    {N, 0, 0, 0, NOC},
  655. X    /* 44*/    {N, 0, 0, 0, "Q"},
  656. X    /* 45*/    {N, 0, 0, 0, "T"},
  657. X    /* 46*/    {N, 0, 0, 0, "O"},
  658. X    /* 47*/    {N, 0, 0, 0, "H"},
  659. X    /* 48*/    {N, 0, 0, 0, "N"},
  660. X    /* 49*/    {N, 0, 0, 0, "M"},
  661. X    /* 50*/    {N, 0, 0, 0, "L"},
  662. X    /* 51*/    {N, 0, 0, 0, "R"},
  663. X    /* 52*/    {N, 0, 0, 0, "G"},
  664. X    /* 53*/    {N, 0, 0, 0, "I"},
  665. X    /* 54*/    {N, 0, 0, 0, "P"},
  666. X    /* 55*/    {N, 0, 0, 0, "C"},
  667. X    /* 56*/    {N, 0, 0, 0, "V"},
  668. X    /* 57*/    {N, 0, 0, 0, "E"},
  669. X    /* 58*/    {N, 0, 0, 0, "Z"},
  670. X    /* 59*/    {N, 0, 0, 0, "D"},
  671. X    /* 60*/    {N, 0, 0, 0, "B"},
  672. X    /* 61*/    {N, 0, 0, 0, "S"},
  673. X    /* 62*/    {N, 0, 0, 0, "Y"},
  674. X    /* 63*/    {N, 0, 0, 0, "F"},
  675. X    /* 64*/    {N, 0, 0, 0, "X"},
  676. X    /* 65*/    {N, 0, 0, 0, "A"},
  677. X    /* 66*/    {N, 0, 0, 0, "W"},
  678. X    /* 67*/    {N, 0, 0, 0, "J"},
  679. X    /* 68*/    {N, 0, 0, 0, "U"},
  680. X    /* 69*/    {N, 0, 0, 0, "K"},
  681. X    /* 70*/    {N, 0, 0, 0, "0"},
  682. X    /* 71*/    {N, 0, 0, 0, "1"},
  683. X    /* 72*/    {N, 0, 0, 0, "2"},
  684. X    /* 73*/    {N, 0, 0, 0, "3"},
  685. X    /* 74*/    {N, 0, 0, 0, "4"},
  686. X    /* 75*/    {N, 0, 0, 0, "5"},
  687. X    /* 76*/    {N, 0, 0, 0, "6"},
  688. X    /* 77*/    {N, 0, 0, 0, "7"},
  689. X    /* 78*/    {N, 0, 0, 0, "8"},
  690. X    /* 79*/    {N, 0, 0, 0, "9"},
  691. X    /* 80*/    {N, 0, 0, 0, "*"},
  692. X    /* 81*/    {N, 0, 0, 0, "\261"},
  693. X    /* 82*/    {N, 0, 0, 0, "\256"},
  694. X    /* 83*/    {N, 0, 0, 0, "\257"},
  695. X    /* 84*/    {D, 0, 0, 0, "doff"},
  696. X    /* 85*/    {N, 0, 0, 0, "\242"},
  697. X    /* 86*/    {D, 0, 0, 0, "doFl"},
  698. X    /* 87*/    {D, 0, 0, 0, "doFi"},
  699. X    /* 88*/    {N, 0, 0, 0, "("},
  700. X    /* 89*/    {N, 0, 0, 0, ")"},
  701. X    /* 90*/    {N, 0, 0, 0, "["},
  702. X    /* 91*/    {N, 0, 0, 0, "]"},
  703. X    /* 92*/    {S, 0, 0, 0, "\260"},
  704. X    /* 93*/    {N, 0, 0, 0, "\262"},
  705. X    /* 94*/    {N, 0, 0, 0, "="},
  706. X    /* 95*/    {S, 0, 0, 0, "\322"},
  707. X    /* 96*/    {N, 0, 0, 0, ":"},
  708. X    /* 97*/    {N, 0, 0, 0, "+"},
  709. X    /* 98*/    {N, 0, 0, 0, NOC},
  710. X    /* 99*/    {N, 0, 0, 0, "!"},
  711. X    /*100*/    {N, 0, 0, 0, "\267"},
  712. X    /*101*/    {N, 0, 0, 0, "?"},
  713. X    /*102*/    {S, 0, 0, 0, "\242"},
  714. X    /*103*/    {N, -60, 0, 0, "|"},
  715. X    /*104*/    {N, 0, 0, 0, NOC},
  716. X    /*105*/    {S, 0, 0, 0, "\323"},
  717. X    /*106*/    {D, 0, 0, 0, "dosq"},
  718. X    /*107*/    {N, 0, 0, 0, "$"},
  719. X    };
  720. X
  721. Xstruct troff2befont psSymFont[] = {
  722. X/*          +-------------------------------- Troff character number
  723. X        |
  724. X            |    +--------------------------- N: standard fonts
  725. X            |    |                            S: symbol font
  726. X            |    |                            D: draw macro
  727. X            |    |                            n: new font
  728. X            |    |
  729. X            |    |  +------------------------ X-shift (scaled by point)
  730. X            |    |  |                         Note: positive is right.
  731. X            |    |  |
  732. X            |    |  |  +--------------------- Y-shift (scaled by point)
  733. X            |    |  |  |                      Note: positive is up.
  734. X            |    |  |  |
  735. X            |    |  |  |  +------------------ Point scale factor
  736. X            |    |  |  |  |
  737. X            |    |  |  |  |   +-------------- Sequence
  738. X            |    |  |  |  |   |
  739. X            v    v  v  v  v   v */
  740. X    /*  0*/    {S, 0, 0, 0, "\171"},
  741. X    /*  1*/    {S, 0, 0, 0, "\161"},
  742. X    /*  2*/    {S, 0, 0, 0, "\156"},
  743. X    /*  3*/    {S, 0, 0, 0, "\155"},
  744. X    /*  4*/    {S, 0, 0, 0, "\154"},
  745. X    /*  5*/    {S, 0, 0, 0, "\151"},
  746. X    /*  6*/    {S, 0, 0, 0, "\172"},
  747. X    /*  7*/    {S, 0, 0, 0, "\163"},
  748. X    /*  8*/    {S, 0, 0, 0, "\144"},
  749. X    /*  9*/    {S, 0, 0, 0, "\142"},
  750. X    /* 10*/    {S, 0, 0, 0, "\170"},
  751. X    /* 11*/    {S, 0, 0, 0, "\150"},
  752. X    /* 12*/    {S, 0, 0, 0, "\146"},
  753. X    /* 13*/    {S, 0, 0, 0, "\165"},
  754. X    /* 14*/    {S, 0, 0, 0, "\153"},
  755. X    /* 15*/    {S, 0, 0, 0, NOC},
  756. X    /* 16*/    {S, 0, 0, 0, "\160"},
  757. X    /* 17*/    {N, 0, 0, 0, "@"},
  758. X    /* 18*/    {S, 0, 0, 0, "\257"},
  759. X    /* 19*/    {S, 0, 0, 0, NOC},
  760. X    /* 20*/    {S, 0, 0, 0, "\141"},
  761. X    /* 21*/    {S, 0, 0, 0, "\174"},
  762. X    /* 22*/    {S, 0, 0, 0, "\143"},
  763. X    /* 23*/    {N, 0, 0, 0, "\042"},
  764. X    /* 24*/    {S, 0, 0, 0, "\145"},
  765. X    /* 25*/    {S, 0, 0, 0, "\075"},
  766. X    /* 26*/    {S, 0, 0, 0, "\157"},
  767. X    /* 27*/    {S, 0, 0, 0, "\254"},
  768. X    /* 28*/    {S, 0, 0, 0, "\162"},
  769. X    /* 29*/    {S, 0, 0, 0, "\255"},
  770. X    /* 30*/    {S, 0, 0, 0, "\164"},
  771. X    /* 31*/    {4, 0, 0, 0, "O"},
  772. X    /* 32*/    {N, 0, 0, 0, "\134"},
  773. X    /* 33*/    {S, 0, 0, 0, "\131"},
  774. X    /* 34*/    {D, 0, 0, 0, "BellSymbol"},
  775. X    /* 35*/    {S, 0, 0, 0, "\245"},
  776. X    /* 36*/    {S, 0, 0, 0, "\147"},
  777. X    /* 37*/    {S, 0, 0, 0, "\312"},
  778. X    /* 38*/    {S, 0, 0, 0, "\265"},
  779. X    /* 39*/    {S, 0, 0, 0, "\336"},
  780. X    /* 40*/    {S, 0, 0, 0, "\167"},
  781. X    /* 41*/    {S, 0, 0, 0, NOC},
  782. X    /* 42*/    {S, 0, 0, 0, "\321"},
  783. X    /* 43*/    {S, 0, 0, 0, NOC},
  784. X    /* 44*/    {S, 0, 0, 0, "\106"},
  785. X    /* 45*/    {S, 0, 0, 0, "\121"},
  786. X    /* 46*/    {S, 0, 0, 0, "\127"},
  787. X    /* 47*/    {S, 0, 0, 0, "\310"},
  788. X    /* 48*/    {4, 0, 0, 0, "M"},
  789. X    /* 49*/    {S, 0, 0, 0, "\126"},
  790. X    /* 50*/    {S, 0, 0, 0, "\114"},
  791. X    /* 51*/    {S, 0, 0, 0, "\055"},
  792. X    /* 52*/    {S, 0, 0, 0, "\107"},
  793. X    /* 53*/    {S, 0, 0, 0, "\362"},
  794. X    /* 54*/    {S, 0, 0, 0, "\120"},
  795. X    /* 55*/    {S, 0, 0, 0, "\314"},
  796. X    /* 56*/    {S, 0, 0, 0, "\311"},
  797. X    /* 57*/    {N, 0, 0, 0, "\176"},
  798. X    /* 58*/    {S, 0, 0, 0, "\266"},
  799. X    /* 59*/    {S, 0, 0, 0, "\104"},
  800. X    /* 60*/    {S, 0, 0, 0, "\326"},
  801. X    /* 61*/    {S, 0, 0, 0, "\123"},
  802. X    /* 62*/    {S, 0, 0, 0, "\273"},
  803. X    /* 63*/    {S, 0, 0, 0, "\076"},
  804. X    /* 64*/    {S, 0, 0, 0, "\130"},
  805. X    /* 65*/    {S, 0, 0, 0, "\074"},
  806. X    /* 66*/    {S, 0, 0, 0, "\244"},
  807. X    /* 67*/    {S, 0, 0, 0, "\307"},
  808. X    /* 68*/    {S, 0, 0, 0, "\125"},
  809. X    /* 69*/    {S, 0, 0, 0, "\330"},
  810. X    /* 70*/    {4, 0, 0, 0, "J"},
  811. X    /* 71*/    {4, 0, 0, 0, "B"},
  812. X    /* 72*/    {4, 0, 0, 0, "A"},
  813. X    /* 73*/    {4, 0, 0, 0, "C"},
  814. X    /* 74*/    {4, 0, 0, 0, "D"},
  815. X    /* 75*/    {4, 0, 0, 0, "E"},
  816. X    /* 76*/    {4, 0, 0, 0, "F"},
  817. X    /* 77*/    {4, 0, 0, 0, "G"},
  818. X    /* 78*/    {4, 0, 0, 0, "K"},
  819. X    /* 79*/    {4, 0, 0, 0, "I"},
  820. X    /* 80*/    {4, 0, 0, 0, "H"},
  821. X    /* 81*/    {S, 0, 0, 0, "\264"},
  822. X    /* 82*/    {S, 0, 0, 0, "\270"},
  823. X    /* 83*/    {S, 0, 0, 0, "\261"},
  824. X    /* 84*/    {S, 0, 0, 0, "\243"},
  825. X    /* 85*/    {S, 0, 0, 0, "\263"},
  826. X    /* 86*/    {S, 0, 0, 0, "\272"},
  827. X    /* 87*/    {S, 0, 0, 0, "\271"},
  828. X    /* 88*/    {S, 0, 0, 0, "\173"},
  829. X    /* 89*/    {S, 0, 0, 0, "\175"},
  830. X    /* 90*/    {N, 0, 0, 0, "\302"},
  831. X    /* 91*/    {N, 0, 0, 0, "\301"},
  832. X    /* 92*/    {N, 0, 0, 0, "\303"},
  833. X    /* 93*/    {N, 0, 0, 0, "\043"},
  834. X    /* 94*/    {S, 0, 0, 0, "\334"},
  835. X    /* 95*/    {S, 0, 0, 0, "\316"},
  836. X    /* 96*/    {N, 0, 0, 0, "\304"},
  837. X    /* 97*/    {S, 0, 0, 0, "\306"},
  838. X    /* 98*/    {S, 0, 0, 0, NOC},
  839. X    /* 99*/    {N, 0, 0, 0, "\263"},
  840. X    /*100*/    {4, 0, 0, 0, "L"},
  841. X    /*101*/    {S, 0, 0, 0, "\052"},
  842. X    /*102*/    {S, 0, 0, 0, "\315"},
  843. X    /*103*/    {4, 0, 0, 0, "N"},
  844. X    /*104*/    {S, 0, 0, 0, NOC},
  845. X    /*105*/    {S, 0, 0, 0, "\053"},
  846. X    /*106*/    {S, 0, 0, 0, "\256"},
  847. X    /*107*/    {N, 0, 0, 0, "\247"},
  848. X};
  849. X
  850. XpsPage() {
  851. X    if (!currentPage)
  852. X    return;
  853. X    printf("hits misses\n");
  854. X    printf("PageSave restore\n");
  855. X    printf("/misses exch def /hits exch def\n");
  856. X    printf("ShowPage\n");
  857. X    pagePending = 1;
  858. X}
  859. X
  860. Xstatic
  861. XdoPageStart() {
  862. X    currentPage++;
  863. X    printf("%%%%Page: ? %d\n", currentPage);
  864. X#ifdef    FORM
  865. X    printf("/Form { %s } def\n",
  866. X    Overlay[0] == '+' ? (Overlay[0] = '\0', Overlay+1) : Overlay);
  867. X#endif
  868. X    printf("/PageSave save def\n");
  869. X    pagePending = 0;
  870. X    printf("StartPage\n");
  871. X}
  872. X
  873. XpsSetFont(font, points)
  874. Xint font, points; {
  875. X    if (lastPoints != points || font != lastFont) {
  876. X    struct fonttable *fp = &fonttable[font];
  877. X    if (fp->fontSeq && *fp->fontSeq && !(fp->flags&USED)) {
  878. X        char buffer[512];
  879. X        int n;
  880. X        FILE *f = fopen(fp->fontSeq, "r");
  881. X        if (!f) {
  882. X        fprintf(stderr, "%s: cannot open fontfile %s\n",
  883. X            progname, fp->fontSeq);
  884. X        } else {
  885. X        DBP((D_BEND,"Downloading %s\n", fp->fontSeq));
  886. X        while((n = fread(buffer, 1, sizeof(buffer), f)) > 0) {
  887. X            fwrite(buffer, 1, n, stdout);
  888. X        }
  889. X        fclose(f);
  890. X        }
  891. X    }
  892. X
  893. X    fp->flags |= USED;
  894. X#ifdef    FONTMACRO
  895. X    printf("/%s %d SetFont\n", fp->fontName, points);
  896. X#else
  897. X    printf("/%s dup /curFont exch def findfont\n",
  898. X        fp->fontName);
  899. X    printf("%d dup /curPoints exch def scalefont setfont\n", points);
  900. X#endif
  901. X    lastPoints = points;
  902. X    lastFont = font;
  903. X    }
  904. X}
  905. X
  906. XpsChar(x, y, font, points, troffChar, sequence)
  907. Xint x, y;
  908. Xint font, points, troffChar;
  909. Xregister char *sequence; {
  910. X    register int nx = TROFF2PSX(x), ny = TROFF2PSY(y);
  911. X    register struct troff2befont *rp;
  912. X
  913. X    if (pagePending) {
  914. X    resetState();
  915. X    doPageStart();
  916. X    }
  917. X
  918. X    charCount++;
  919. X
  920. X    DBP((D_BEND,"BEFORE (troffChar,x,y,font,points) = (%d,%d,%d,%d,%d)\n",
  921. X    troffChar, x, y, font, points));
  922. X    if (font < 0) {
  923. X    font = -font-1;
  924. X    rp = &extchars[troffChar];
  925. X    } else if (font == symidx)
  926. X    rp = &be->besymfont[troffChar];
  927. X    else
  928. X    rp = &be->bestdfont[troffChar];
  929. X
  930. X    switch(rp->t2b_font) {
  931. X    /* Only fonts with "N" are subject to font translation */
  932. X    case N:
  933. X        if (font == symidx)
  934. X        font = 0;    /* Special chars are Courier */
  935. X        else {
  936. X        DBP((D_BEND,"psSetChar %d->%s (%s)\n", font,
  937. X            xlatetable[font]->troffName,
  938. X            xlatetable[font]->fontName));
  939. X        font = xlatetable[font] - fonttable;
  940. X        }
  941. X        break;
  942. X    case S:
  943. X        font = 3;
  944. X        break;
  945. X    case D:
  946. X        break;
  947. X    default:
  948. X        /* Typically used when the R and S fonts don't have the
  949. X           character desired, so select the font via the index
  950. X           in the fonts.?? file */
  951. X        font = rp->t2b_font;
  952. X        break;
  953. X    }
  954. X
  955. X    skipfontset:
  956. X
  957. X    if (!sequence)
  958. X    sequence = rp->t2b_charseq;
  959. X
  960. X    if (!sequence) {
  961. X    fprintf(stderr, "No coding for %d\n", troffChar);
  962. X    return;
  963. X    }
  964. X
  965. X    /*    We're committed now - the "if" statements avoid floating
  966. X    arithmetic on slow machines */
  967. X
  968. X    if (rp->t2b_scale) points *= (.01 * rp->t2b_scale);
  969. X    if (rp->t2b_xc) nx += points * (.01 * rp->t2b_xc);
  970. X    if (rp->t2b_yc) ny += points * (.01 * rp->t2b_yc);
  971. X
  972. X    psSetFont(font, points);
  973. X
  974. X    DBP((D_BEND,"AFTER (sequence,x,y,font,points) = (%s,%d,%d,%d,%d)\n",
  975. X    sequence, nx, ny, font, points));
  976. X
  977. X    if (rp->t2b_font == D) {
  978. X    emitnums(nx);
  979. X    emitnums(ny);
  980. X    putnl(sequence);
  981. X    } else {
  982. X    emitnum(nx);
  983. X    if (lastYPos != ny) {
  984. X        putchar(' ');
  985. X        emitnum(ny);
  986. X    }
  987. X    putchar('(');
  988. X    while(*sequence) {
  989. X        if ((*sequence)&0x80)
  990. X        printf("\\%03o", (*sequence++)&0xff);
  991. X        else if (*sequence == '(' || *sequence == ')' ||
  992. X        *sequence == '\\')
  993. X        printf("\\%c", *sequence++);
  994. X        else
  995. X        putchar(*sequence++);
  996. X    }
  997. X    putchar(')');
  998. X    if (lastYPos != ny) {
  999. X        lastYPos = ny;
  1000. X        putchar('Y');
  1001. X    } else
  1002. X        putchar('X');
  1003. X    putchar('\n');
  1004. X    }
  1005. X}
  1006. X
  1007. X/*    Specialized emit routine:
  1008. X    outputs number divided by PSSCALEFACTOR, rounded to the first
  1009. X    decimal place without using floats/double
  1010. X */
  1011. Xemitnums(val)
  1012. Xregister int val; {
  1013. X    emitnum(val);
  1014. X    putchar(' ');
  1015. X}
  1016. Xemitnum(val)
  1017. Xregister int val; {
  1018. X    register int neg;
  1019. X    if (val < 0) {
  1020. X    neg = 1;
  1021. X    val = -val;
  1022. X    } else {
  1023. X    neg = 0;
  1024. X    }
  1025. X    if (neg)
  1026. X    putchar('-');
  1027. X    printf("%d", val / PSSCALEFACTOR);
  1028. X    val = ((val % PSSCALEFACTOR) * 10 /*+ (PSSCALEFACTOR / 2)*/) /
  1029. X    PSSCALEFACTOR;
  1030. X    if (val)
  1031. X    printf(".%d", val);
  1032. X}
  1033. Xputnl(s)
  1034. Xchar *s; {
  1035. X    fputs(s, stdout);
  1036. X    putchar('\n');
  1037. X}
  1038. X
  1039. Xextern char nodename[];
  1040. X
  1041. XpsProlog() {
  1042. X    extern char *ctime();
  1043. X    extern char *strchr();
  1044. X#ifdef    DIT
  1045. X    extern int indtres;
  1046. X#endif
  1047. X    char buffer[30];
  1048. X    FILE *library;
  1049. X    long curtime;
  1050. X
  1051. X    currentPage = 0;
  1052. X    pagePending = 1;
  1053. X
  1054. X    library = libopen(printer, "lib");
  1055. X
  1056. X    time(&curtime);
  1057. X    strcpy(buffer, ctime(&curtime));
  1058. X    *strchr(buffer, '\n') = '\0';
  1059. X    getnodename();
  1060. X
  1061. X    printf("%%!PS-Adobe-1.0\n");
  1062. X    printf("%%%%Title: (stdin)\n");
  1063. X    printf("%%%%Creator: %s %s\n", progname, shortversion);
  1064. X    printf("%%%%PsroffVersion: %s\n", version);
  1065. X    printf("%%%%CreationDate: %s\n", buffer);
  1066. X    printf("%%%%For: %s\n", username);
  1067. X    printf("%%%%Pages: (atend)\n");
  1068. X    printf("%%%%DocumentFonts: (atend)\n");
  1069. X    printf("%%%%EndComments\n");
  1070. X    printf("/GlobalSave save def\n");
  1071. X    printf("/hits 0 def /misses 0 def\n");
  1072. X    /* special backends (eg: psfig) need this */
  1073. X    printf("/resolution %d def\n",
  1074. X#ifdef    DIT
  1075. X    ditroff? indtres:
  1076. X#endif
  1077. X    TROFFRESOLUTION);
  1078. X#ifndef    NOCHATTER
  1079. X    /* compatibility with behandler.ps */
  1080. X    printf("statusdict /jobname (%s@%s %s %s %s) def\n",
  1081. X    username, nodename, buffer, progname, shortversion);
  1082. X    printf("(%s@%s %s %s %s\\n) print\n", username, nodename, buffer,
  1083. X    progname, shortversion);
  1084. X    printf("flush\n");
  1085. X#endif
  1086. X    printf("usertime /btime exch def\n");
  1087. X    psXlate(library);
  1088. X    doprologs();
  1089. X    printf("%%%%EndProlog\n");
  1090. X    fclose(library);
  1091. X}
  1092. X
  1093. XpsEpilog() {
  1094. X    int i;
  1095. X    if (!currentPage)
  1096. X    return;
  1097. X    printf("%%%%Trailer\n");
  1098. X    if (metrics)
  1099. X    printf("%d metrics\n", charCount);
  1100. X#ifndef    NOCHATTER
  1101. X    printf("(Execution time (seconds): ) print\n");
  1102. X    printf("usertime btime sub 0.001 mul (          ) cvs print\n");
  1103. X    printf("(; Pages: %d) print\n", currentPage);
  1104. X    printf("(\\n) print\n");
  1105. X    printf("flush\n");
  1106. X#endif
  1107. X    /* If in display postscript */
  1108. X    printf("DPS? { (^D to exit\\n) print } if\n");
  1109. X    printf("GlobalSave restore\n");
  1110. X    printf("%%%%DocumentFonts:");
  1111. X    for (i = 0; i < MAXFONTS; i++)
  1112. X    if (fonttable[i].flags&USED)
  1113. X        printf(" %s", fonttable[i].fontName);
  1114. X    printf("\n");
  1115. X    printf("%%%%Pages: %d\n", currentPage);
  1116. X#ifndef    NOCONTROLD
  1117. X    fputs(pstrailer, stdout);
  1118. X#endif
  1119. X}
  1120. X
  1121. XpsXlate(library)
  1122. XFILE *library; {
  1123. X    char buf[512];
  1124. X    while (fgets(buf, sizeof(buf), library))
  1125. X    if (0 == strncmp(buf, "%%%", 3))
  1126. X        interp(&buf[3], psXlate, "ps");
  1127. X    else
  1128. X        /* some backends don't like extra %! - eg: PageView */
  1129. X        if (0 == strncmp(buf, "%!", 2)) {
  1130. X        buf[1] = '%';
  1131. X        fputs(&buf[1], stdout);
  1132. X        } else
  1133. X        fputs(buf, stdout);
  1134. X}
  1135. X
  1136. XpsOverlay(overlay)
  1137. Xchar *overlay; {
  1138. X#ifdef    FORM
  1139. X    strcpy(Overlay, overlay);
  1140. X    printf("%%%%%%Form set: %s\n", Overlay);
  1141. X#endif
  1142. X}
  1143. X
  1144. X#ifdef    INSPECIAL
  1145. X
  1146. Xstatic
  1147. Xrequire(need, have, cmd, string)
  1148. Xint need, have;
  1149. Xchar *cmd, *string; {
  1150. X    if (need != have) {
  1151. X    fprintf(stderr, "%s: need %d argument%s to draw a %s (%s)\n",
  1152. X        progname, need, need == 1? "": "s", cmd, string);
  1153. X    return(1);
  1154. X    } else
  1155. X    return(0);
  1156. X}
  1157. X
  1158. X/*    Do ditroff drawing command in s from origX,origY.
  1159. X    If opcode 0 just moveto
  1160. X */
  1161. XpsDraw(origX, origY, opcode, ctindex, numbers, saves)
  1162. Xint origX, origY;
  1163. Xint opcode;
  1164. Xchar *saves;
  1165. Xint ctindex;
  1166. Xshort *numbers; {
  1167. X
  1168. X    int i, fill = 0;
  1169. X    static float curfill = 0;
  1170. X    int curthick = 1;
  1171. X
  1172. X    /* map absolute beginning position. */
  1173. X    origX = TROFF2PSX(origX);
  1174. X    origY = TROFF2PSY(origY);
  1175. X
  1176. X    switch (opcode) {
  1177. X    case 'f':
  1178. X        if (ctindex == 2)
  1179. X        ctindex = 1;
  1180. X        if (!require(1, ctindex, "set fill", saves))
  1181. X        curfill = (double) numbers[0] / 1000;
  1182. X        return;
  1183. X    case 't':
  1184. X        if (ctindex == 2)
  1185. X        ctindex = 1;
  1186. X        if (!require(1, ctindex, "set thick", saves))
  1187. X        curthick = numbers[0];
  1188. X        return;
  1189. X    }
  1190. X    if (opcode)
  1191. X    putnl("newpath");
  1192. X    emitnums(origX);
  1193. X    emitnums(origY);
  1194. X    putnl("moveto");
  1195. X    if (!opcode)
  1196. X    return;
  1197. X
  1198. X    DBP((D_CAT, "psDraw: (%d,%d): %s\n", origX, origY, saves));
  1199. X
  1200. X    switch (opcode) {
  1201. X    case 'C':
  1202. X        if (ctindex == 2)
  1203. X        ctindex = 1;
  1204. X    case 'E':
  1205. X    case 'P':
  1206. X        fill = 1;
  1207. X        if (opcode != 'P')
  1208. X        break;
  1209. X    case 'l':
  1210. X    case 'a':
  1211. X    case 'p':
  1212. X    case '~':
  1213. X        for (i = 1; i < ctindex; i += 2)
  1214. X        numbers[i] = -numbers[i];
  1215. X    }
  1216. X    switch(opcode) {
  1217. X    case 'l':
  1218. X        if (require(2, ctindex, "line", saves))
  1219. X        return;
  1220. X        DBP((D_CAT, "drawline: %d, %d\n", numbers[0], numbers[1]));
  1221. X        emitnums((int) numbers[0]);
  1222. X        emitnums((int) numbers[1]);
  1223. X        putnl("rlineto");
  1224. X        break;
  1225. X    case 'a':
  1226. X        if (require(4, ctindex, "arc", saves))
  1227. X        return;
  1228. X        for (i = 0; i < 4; i++) {
  1229. X        emitnums(numbers[i]);
  1230. X        }
  1231. X        putnl("Arc");
  1232. X        break;
  1233. X    case 'C':
  1234. X    case 'c':
  1235. X        if (require(1, ctindex, "circle", saves))
  1236. X        return;
  1237. X        numbers[1] = numbers[0];
  1238. X        ctindex++;
  1239. X    case 'E':
  1240. X    case 'e':
  1241. X        if (require(2, ctindex, "ellipse", saves))
  1242. X        return;
  1243. X        DBP((D_CAT, "drawellipse: %d, %d\n", numbers[0], numbers[1]));
  1244. X        emitnums((int) numbers[0]);
  1245. X        emitnums((int) numbers[1]);
  1246. X        putnl("Ellipse");
  1247. X        break;
  1248. X    case 'P':
  1249. X    case 'p':
  1250. X        if (ctindex&1) {
  1251. X        fprintf(stderr, "%s: even number of points for polygon: %s\n",
  1252. X            progname, saves);
  1253. X        break;
  1254. X        }
  1255. X        for (i = 0; i < ctindex; i += 2) {
  1256. X        emitnums((int) numbers[i]);
  1257. X        emitnums((int) numbers[i+1]);
  1258. X        putnl("rlineto");
  1259. X        }
  1260. X        putnl(" closepath");
  1261. X        break;
  1262. X    case '~':
  1263. X        if (ctindex < 4) {
  1264. X        fprintf(stderr, "%s: too few points to spline: %s\n",
  1265. X            progname, saves);
  1266. X        break;
  1267. X        }
  1268. X        emitnums(numbers[0]/2);
  1269. X        emitnums(numbers[1]/2);
  1270. X        putnl("rlineto");
  1271. X        /* NUM/DEN should be between 0 and 1; the closer it is to 1
  1272. X        the tighter the curve will be to the guiding lines; 2/3
  1273. X        is the standard value */
  1274. X#define    NUM    2
  1275. X#define    DEN    3
  1276. X        for (i = 0; i < ctindex - 2; i += 2) {
  1277. X        emitnums((numbers[i]*NUM)/(2*DEN));
  1278. X        emitnums((numbers[i + 1]*NUM)/(2*DEN));
  1279. X        emitnums(numbers[i]/2 + (numbers[i + 2]*(DEN - NUM))/(2*DEN));
  1280. X        emitnums(numbers[i + 1]/2 + (numbers[i + 3]*(DEN - NUM))/(2*DEN));
  1281. X        emitnums((numbers[i] - numbers[i]/2) + numbers[i + 2]/2);
  1282. X        emitnums((numbers[i + 1] - numbers[i + 1]/2) + numbers[i + 3]/2);
  1283. X        putnl("rcurveto");
  1284. X        }
  1285. X        emitnums(numbers[ctindex - 2] - numbers[ctindex - 2]/2);
  1286. X        emitnums(numbers[ctindex - 1] - numbers[ctindex - 1]/2);
  1287. X        putnl("rlineto");
  1288. X        break;
  1289. X    default:
  1290. X        fprintf(stderr, "%s: invalid draw code %c (%s)\n", progname, opcode,
  1291. X        saves);
  1292. X        break;
  1293. X    }
  1294. X    if (fill)
  1295. X    printf("%.3f dofill\n", curfill);
  1296. X    else
  1297. X    printf("%d dost\n", curthick);
  1298. X}
  1299. X#endif
  1300. X#endif /* PS */
  1301. END_OF_FILE
  1302.   if test 19969 -ne `wc -c <'ps.c'`; then
  1303.     echo shar: \"'ps.c'\" unpacked with wrong size!
  1304.   fi
  1305.   # end of 'ps.c'
  1306. fi
  1307. if test -f 'utils/maps/cmtrf.ROMAN8' -a "${1}" != "-c" ; then 
  1308.   echo shar: Will not clobber existing file \"'utils/maps/cmtrf.ROMAN8'\"
  1309. else
  1310.   echo shar: Extracting \"'utils/maps/cmtrf.ROMAN8'\" \(93 characters\)
  1311.   sed "s/^X//" >'utils/maps/cmtrf.ROMAN8' <<'END_OF_FILE'
  1312. X#2.1 90/07/18
  1313. X0x3C    0x3C    <
  1314. X0x3E    0x3E    >
  1315. X0x10    0x7C    br
  1316. X0x0E    0x5F    ul/ru
  1317. X{
  1318. X}
  1319. X\
  1320. X0x13    0xfc    solid box
  1321. END_OF_FILE
  1322.   if test 93 -ne `wc -c <'utils/maps/cmtrf.ROMAN8'`; then
  1323.     echo shar: \"'utils/maps/cmtrf.ROMAN8'\" unpacked with wrong size!
  1324.   fi
  1325.   # end of 'utils/maps/cmtrf.ROMAN8'
  1326. fi
  1327. if test -f 'utils/psdtwd.S' -a "${1}" != "-c" ; then 
  1328.   echo shar: Will not clobber existing file \"'utils/psdtwd.S'\"
  1329. else
  1330.   echo shar: Extracting \"'utils/psdtwd.S'\" \(20065 characters\)
  1331.   sed "s/^X//" >'utils/psdtwd.S' <<'END_OF_FILE'
  1332. X%%STARTSHELL%%
  1333. X#    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  1334. X#        All Rights Reserved
  1335. X#
  1336. X#    See the LICENSE file for a full description of the restrictions
  1337. X#    under which this software is provided.
  1338. X#
  1339. X#    Most of this program was written by Michael Rourke (see below)
  1340. X#    to generate ditroff width tables from Postscript.  The original
  1341. X#    name (as distributed in tpscript) was genftable.  It has been
  1342. X#    extended to support more fonts than the original, plus attempt
  1343. X#    to handle non-builtin fonts.  This shell script's output should
  1344. X#    be sent to your postscript printer, and the printer will send
  1345. X#    back up the serial link a series of shars containing the
  1346. X#    width tables.
  1347. X#
  1348. X#    The program goes through all existing characters in the font
  1349. X#    to print width information in ditroff format.  The name of each
  1350. X#    character's drawing routine is used to look up how to print the
  1351. X#    width information.  There are three tables: the standard-encoding,
  1352. X#    symbol-encoding and ascii-map.  The first two are dictionaries,
  1353. X#    the third is an array.  If the font you've asked for is "Symbol",
  1354. X#    the symbol-encoding dictionary is used, otherwise standard-encoding.
  1355. X#    If the drawing routine isn't in the selected dictionary, the
  1356. X#    character code is used to look up in ascii-map for a new name.
  1357. X#    The new name is then searched for in standard-encoding to print the
  1358. X#    width information.
  1359. X#
  1360. X#    This latter kludge is necessary for fonts that don't use the
  1361. X#    standard naming conventions, and will work sanely only for characters
  1362. X#    32 (space) thru 126 (tilde).
  1363. X#
  1364. X#    usage: psdtwd <arguments>
  1365. X#
  1366. X#    if there are no arguments, pstdwd will generate widths for
  1367. X#    all of the fonts that are listed at the end of this shell
  1368. X#    script.  Arguments are usually repeated quoted
  1369. X#    strings of the form:
  1370. X#        /psname /intname /catname fontinfo
  1371. X#    Where psname is the Postscript name of the font.  intname is
  1372. X#    a shortened name (which psroff doesn't care about, but ditroff
  1373. X#    does apparently), catname is the one or two character name that
  1374. X#    cat will know it by (and will be the name of the resultant shar),
  1375. X#    and fontinfo is itself.
  1376. X#    If the argument is a readable filename instead, it is inserted.
  1377. X#    For example:
  1378. X#    ./psdtwd hwfont "/HaeberliWriting /HaeberliW /HW fontinfo" \
  1379. X#        "/Times-Roman /Roman /R fontinfo"
  1380. X#    will insert file hwfont (usually containing the definition of the
  1381. X#    subsequent argument), and generate the widths in a file HW of
  1382. X#    the HaeberliWriting font, plus the widths for the "Times-Roman"
  1383. X#    font in R.
  1384. Xif [ $# = 0 ]
  1385. Xthen
  1386. X    all=1
  1387. Xelse
  1388. X    while [ $# != 0 ]
  1389. X    do
  1390. X    if [ -r $1 ]
  1391. X    then
  1392. X        files="$files $1"
  1393. X    else
  1394. X        lines="$lines $1"
  1395. X    fi
  1396. X    shift
  1397. X    done
  1398. Xfi
  1399. Xcat <<'END'
  1400. X%!
  1401. X% psdtwd -    Postcript program to produce font tables for ditroff.
  1402. X%          Tables are output on the standard output file - which
  1403. X%          needs to be captured by the host computer.
  1404. X%
  1405. X%          Note the routine "commondefs" which outputs local
  1406. X%          defined (hand built) characters.
  1407. X%
  1408. X% Michael Rourke, University of N.S.W., Australia
  1409. X% (included in troff2: 2.5 91/03/19)
  1410. X/SAVEOBJ save def
  1411. X
  1412. X/t 30 string def
  1413. X
  1414. X(Starting psdtwd.ps `date`\n) print
  1415. Xflush
  1416. X
  1417. X/ps
  1418. X% string ->
  1419. X{
  1420. X    print
  1421. X} def
  1422. X
  1423. X/pr
  1424. X% any -->
  1425. X{
  1426. X    t cvs ps
  1427. X} def
  1428. X
  1429. X/prsp
  1430. X{
  1431. X    (\t) ps
  1432. X} def
  1433. X
  1434. X/prnl
  1435. X{
  1436. X    (\n) ps
  1437. X} def
  1438. X
  1439. X/pro
  1440. X% int -->
  1441. X{
  1442. X    dup 0 eq
  1443. X    { pr }
  1444. X    { dup 8 idiv pro 8 mod pr }
  1445. X    ifelse
  1446. X} def
  1447. X
  1448. X/charsize
  1449. X% string --> bot top
  1450. X{
  1451. X    gsave
  1452. X    newpath 0 0 moveto false charpath flattenpath pathbbox
  1453. X    exch pop 3 -1 roll pop
  1454. X    grestore
  1455. X} def
  1456. X
  1457. X/strwidth
  1458. X% string --> width
  1459. X{
  1460. X    stringwidth pop round cvi
  1461. X} def
  1462. X
  1463. X/prsize
  1464. X% string -->
  1465. X{
  1466. X    dup strwidth pr prsp
  1467. X    dup charsize
  1468. X    top gt { 2 } { 0 } ifelse
  1469. X    exch bot lt { 1 or } if
  1470. X    pr prsp
  1471. X    0 get pro
  1472. X} def
  1473. X
  1474. X/fontinfo
  1475. X% fontname troffinternal troffname
  1476. X{
  1477. X    (\ncat <<"!" > ) ps dup pr prnl
  1478. X    (# ) ps 2 index pr prnl
  1479. X    (# resolution 720, unitwidth 10) ps prnl
  1480. X    (name ) ps pr prnl
  1481. X    (internalname ) ps pr prnl
  1482. X    dup findfont 100 scalefont setfont
  1483. X    /fixedwidth false def
  1484. X    /Symbol eq
  1485. X    {
  1486. X        /actions symbol-encoding def
  1487. X        (special\n) ps
  1488. X    }
  1489. X    {
  1490. X        /actions standard-encoding def
  1491. X        currentfont /FontInfo get /isFixedPitch get
  1492. X        {
  1493. X            (# fixed width\n) ps
  1494. X            /fixedwidth true def
  1495. X        }
  1496. X        {
  1497. X            (ligatures fi fl ff ffi ffl 0\n) ps
  1498. X        }
  1499. X        ifelse
  1500. X    }
  1501. X    ifelse
  1502. X    % use "o" to get top and bottom on a normal char
  1503. X    (o) charsize /top exch def /bot exch def
  1504. X    % some non ascending chars slightly higher than "o"
  1505. X    % and some lower so adjust slightly
  1506. X    /top top 2 add def
  1507. X    /bot bot 4 sub def
  1508. X    /encoding currentfont /Encoding get def
  1509. X    /s 1 string def
  1510. X    0 1 255
  1511. X    {
  1512. X        dup /id exch def
  1513. X        s 0 2 index put
  1514. X        encoding exch get dup /.notdef ne
  1515. X        {
  1516. X            s 1 index actions exch
  1517. X            % actions charfuncname
  1518. X            2 copy known
  1519. X            {
  1520. X                get
  1521. X                % charname charstr /type
  1522. X                exec
  1523. X                flush
  1524. X            }
  1525. X            {
  1526. X                % actions charfuncname
  1527. X                pop
  1528. X                ascii-map id get
  1529. X                2 copy known
  1530. X                {
  1531. X                    get
  1532. X                    % charname charstr /type
  1533. X                    exec
  1534. X                    flush
  1535. X                }
  1536. X                {
  1537. X                    % charname charstr
  1538. X                    pop
  1539. X                    pop
  1540. X                }
  1541. X                ifelse
  1542. X            }
  1543. X            ifelse
  1544. X        }
  1545. X        {
  1546. X            pop
  1547. X        }
  1548. X        ifelse
  1549. X    } for
  1550. X    actions standard-encoding eq { commondefs } if
  1551. X    (!\n) ps flush
  1552. X} def
  1553. X
  1554. X/commondefs
  1555. X{
  1556. X    /fracsize (0) strwidth (\244) strwidth add def        % \244 = '/'
  1557. X    /Fisize (f) strwidth (\256) strwidth add 5 sub def    % \256 = 'fi'
  1558. X    /ffsize (f) strwidth 2 mul 5 sub def
  1559. X    /fl { flush } def
  1560. X    fixedwidth not
  1561. X    {
  1562. X        (ff) ps prsp ffsize pr (\t2\t0100\tff ligature - faked\n) ps fl
  1563. X        (Fi) ps prsp Fisize pr (\t2\t0100\tffi ligature - faked\n) ps fl
  1564. X        (Fl) ps prsp Fisize pr (\t2\t0100\tffl ligature - faked\n) ps fl
  1565. X    } if
  1566. X    (12) ps prsp fracsize pr (\t2\t0100\t1/2 - faked\n) ps fl
  1567. X    (13) ps prsp fracsize pr (\t2\t0100\t1/3 - faked\n) ps fl
  1568. X    (14) ps prsp fracsize pr (\t2\t0100\t1/4 - faked\n) ps fl
  1569. X    (18) ps prsp fracsize pr (\t2\t0100\t1/8 - faked\n) ps fl
  1570. X    (23) ps prsp fracsize pr (\t2\t0100\t2/3 - faked\n) ps fl
  1571. X    (34) ps prsp fracsize pr (\t2\t0100\t3/4 - faked\n) ps fl
  1572. X    (38) ps prsp fracsize pr (\t2\t0100\t3/8 - faked\n) ps fl
  1573. X    (58) ps prsp fracsize pr (\t2\t0100\t5/8 - faked\n) ps fl
  1574. X    (78) ps prsp fracsize pr (\t2\t0100\t7/8 - faked\n) ps fl
  1575. X    (sq\t100\t3\t0100\tsquare box - faked\n) ps fl
  1576. X} def
  1577. X
  1578. X/space
  1579. X% charname charstr -->
  1580. X{
  1581. X    (spacewidth ) ps
  1582. X    strwidth pr pop prnl
  1583. X    (charset\n) ps
  1584. X} def
  1585. X
  1586. X/norm
  1587. X% charname charstr -->
  1588. X{
  1589. X    dup pr prsp prsize pop prnl
  1590. X} def
  1591. X
  1592. X/normdup
  1593. X% charname charstr dupname -->
  1594. X{
  1595. X    3 1 roll norm
  1596. X    pr prsp (") ps prnl
  1597. X} def
  1598. X
  1599. X/gnorm
  1600. X% charname charstr -->
  1601. X{
  1602. X    (*) ps norm
  1603. X} def
  1604. X
  1605. X/map
  1606. X% charname charstr mapname -->
  1607. X{
  1608. X    pr prsp prsize prsp pr prnl
  1609. X} def
  1610. X
  1611. X/mapdup
  1612. X% charname charstr mapname dupname -->
  1613. X{
  1614. X    4 1 roll map
  1615. X    pr prsp (") ps prnl
  1616. X} def
  1617. X
  1618. X/mapdupdup
  1619. X% charname charstr mapname dupname dupname -->
  1620. X{
  1621. X    5 1 roll mapdup
  1622. X    pr prsp (") ps prnl
  1623. X} def
  1624. X
  1625. X/cmap
  1626. X% charname charstr mapname -->
  1627. X{
  1628. X    fixedwidth { 3 { pop } repeat } { map } ifelse
  1629. X} def
  1630. X
  1631. X/ascii-map 256 array def
  1632. X0 1 255 {ascii-map exch /exclam put} for
  1633. X
  1634. Xascii-map 32 /space put
  1635. Xascii-map 33 /exclam put
  1636. Xascii-map 34 /quotedbl put
  1637. Xascii-map 35 /numbersign put
  1638. Xascii-map 36 /dollar put
  1639. Xascii-map 37 /percent put
  1640. Xascii-map 38 /ampersand put
  1641. Xascii-map 39 /quoteright put
  1642. Xascii-map 40 /parenleft put
  1643. Xascii-map 41 /parenright put
  1644. Xascii-map 42 /asterisk put
  1645. Xascii-map 43 /plus put
  1646. Xascii-map 44 /comma put
  1647. Xascii-map 45 /hyphen put
  1648. Xascii-map 46 /period put
  1649. Xascii-map 47 /slash put
  1650. Xascii-map 48 /zero put
  1651. Xascii-map 49 /one put
  1652. Xascii-map 50 /two put
  1653. Xascii-map 51 /three put
  1654. Xascii-map 52 /four put
  1655. Xascii-map 53 /five put
  1656. Xascii-map 54 /six put
  1657. Xascii-map 55 /seven put
  1658. Xascii-map 56 /eight put
  1659. Xascii-map 57 /nine put
  1660. Xascii-map 58 /colon put
  1661. Xascii-map 59 /semicolon put
  1662. Xascii-map 60 /less put
  1663. Xascii-map 61 /equal put
  1664. Xascii-map 62 /greater put
  1665. Xascii-map 63 /question put
  1666. Xascii-map 64 /at put
  1667. Xascii-map 65 /A put
  1668. Xascii-map 66 /B put
  1669. Xascii-map 67 /C put
  1670. Xascii-map 68 /D put
  1671. Xascii-map 69 /E put
  1672. Xascii-map 70 /F put
  1673. Xascii-map 71 /G put
  1674. Xascii-map 72 /H put
  1675. Xascii-map 73 /I put
  1676. Xascii-map 74 /J put
  1677. Xascii-map 75 /K put
  1678. Xascii-map 76 /L put
  1679. Xascii-map 77 /M put
  1680. Xascii-map 78 /N put
  1681. Xascii-map 79 /O put
  1682. Xascii-map 80 /P put
  1683. Xascii-map 81 /Q put
  1684. Xascii-map 82 /R put
  1685. Xascii-map 83 /S put
  1686. Xascii-map 84 /T put
  1687. Xascii-map 85 /U put
  1688. Xascii-map 86 /V put
  1689. Xascii-map 87 /W put
  1690. Xascii-map 88 /X put
  1691. Xascii-map 89 /Y put
  1692. Xascii-map 90 /Z put
  1693. Xascii-map 91 /bracketleft put
  1694. Xascii-map 92 /backslash put
  1695. Xascii-map 93 /bracketright put
  1696. Xascii-map 94 /asciicircum put
  1697. Xascii-map 95 /underscore put
  1698. Xascii-map 96 /quoteleft put
  1699. Xascii-map 97 /a put
  1700. Xascii-map 98 /b put
  1701. Xascii-map 99 /c put
  1702. Xascii-map 100 /d put
  1703. Xascii-map 101 /e put
  1704. Xascii-map 102 /f put
  1705. Xascii-map 103 /g put
  1706. Xascii-map 104 /h put
  1707. Xascii-map 105 /i put
  1708. Xascii-map 106 /j put
  1709. Xascii-map 107 /k put
  1710. Xascii-map 108 /l put
  1711. Xascii-map 109 /m put
  1712. Xascii-map 110 /n put
  1713. Xascii-map 111 /o put
  1714. Xascii-map 112 /p put
  1715. Xascii-map 113 /q put
  1716. Xascii-map 114 /r put
  1717. Xascii-map 115 /s put
  1718. Xascii-map 116 /t put
  1719. Xascii-map 117 /u put
  1720. Xascii-map 118 /v put
  1721. Xascii-map 119 /w put
  1722. Xascii-map 120 /x put
  1723. Xascii-map 121 /y put
  1724. Xascii-map 122 /z put
  1725. Xascii-map 123 /braceleft put
  1726. Xascii-map 124 /bar put
  1727. Xascii-map 125 /braceright put
  1728. Xascii-map 126 /asciitilde put
  1729. X
  1730. X/standard-encoding 149 dict def
  1731. Xstandard-encoding begin
  1732. X    /space        { space }        def
  1733. X    /exclam        { norm }        def
  1734. X    /quotedbl    { norm }        def
  1735. X    /numbersign    { norm }        def
  1736. X    /dollar        { norm }        def
  1737. X    /percent    { norm }        def
  1738. X    /ampersand    { norm }        def
  1739. X    /quoteright    { norm }        def
  1740. X    /parenleft    { norm }        def
  1741. X    /parenright    { norm }        def
  1742. X    /asterisk    { norm }        def
  1743. X    /plus        { norm }        def
  1744. X    /comma        { norm }        def
  1745. X    /hyphen        { (hy) normdup }    def
  1746. X    /period        { norm }        def
  1747. X    /slash        { (sl) normdup }    def
  1748. X    /zero        { norm }        def
  1749. X    /one        { norm }        def
  1750. X    /two        { norm }        def
  1751. X    /three        { norm }        def
  1752. X    /four        { norm }        def
  1753. X    /five        { norm }        def
  1754. X    /six        { norm }        def
  1755. X    /seven        { norm }        def
  1756. X    /eight        { norm }        def
  1757. X    /nine        { norm }        def
  1758. X    /colon        { norm }        def
  1759. X    /semicolon    { norm }        def
  1760. X    /less        { norm }        def
  1761. X    /equal        { norm }        def
  1762. X    /greater    { norm }        def
  1763. X    /question    { norm }        def
  1764. X    /at        { norm }        def
  1765. X    /A        { norm }        def
  1766. X    /B        { norm }        def
  1767. X    /C        { norm }        def
  1768. X    /D        { norm }        def
  1769. X    /E        { norm }        def
  1770. X    /F        { norm }        def
  1771. X    /G        { norm }        def
  1772. X    /H        { norm }        def
  1773. X    /I        { norm }        def
  1774. X    /J        { norm }        def
  1775. X    /K        { norm }        def
  1776. X    /L        { norm }        def
  1777. X    /M        { norm }        def
  1778. X    /N        { norm }        def
  1779. X    /O        { norm }        def
  1780. X    /P        { norm }        def
  1781. X    /Q        { norm }        def
  1782. X    /R        { norm }        def
  1783. X    /S        { norm }        def
  1784. X    /T        { norm }        def
  1785. X    /U        { norm }        def
  1786. X    /V        { norm }        def
  1787. X    /W        { norm }        def
  1788. X    /X        { norm }        def
  1789. X    /Y        { norm }        def
  1790. X    /Z        { norm }        def
  1791. X    /bracketleft    { norm }        def
  1792. X    /backslash    { norm }        def
  1793. X    /bracketright    { norm }        def
  1794. X    /asciicircum    { (a^) map }        def
  1795. X    /underscore    { (ru) normdup }    def
  1796. X    /quoteleft    { norm }        def
  1797. X    /a        { norm }        def
  1798. X    /b        { norm }        def
  1799. X    /c        { norm }        def
  1800. X    /d        { norm }        def
  1801. X    /e        { norm }        def
  1802. X    /f        { norm }        def
  1803. X    /g        { norm }        def
  1804. X    /h        { norm }        def
  1805. X    /i        { norm }        def
  1806. X    /j        { norm }        def
  1807. X    /k        { norm }        def
  1808. X    /l        { norm }        def
  1809. X    /m        { norm }        def
  1810. X    /n        { norm }        def
  1811. X    /o        { norm }        def
  1812. X    /p        { norm }        def
  1813. X    /q        { norm }        def
  1814. X    /r        { norm }        def
  1815. X    /s        { norm }        def
  1816. X    /t        { norm }        def
  1817. X    /u        { norm }        def
  1818. X    /v        { norm }        def
  1819. X    /w        { norm }        def
  1820. X    /x        { norm }        def
  1821. X    /y        { norm }        def
  1822. X    /z        { norm }        def
  1823. X    /braceleft    { norm }        def
  1824. X    /bar        { norm }        def
  1825. X    /braceright    { norm }        def
  1826. X    /asciitilde    { (a~) map }        def
  1827. X    /exclamdown    { (I!) map }        def
  1828. X    /cent        { (ct) map }        def
  1829. X    /sterling    { (po) map }        def
  1830. X    /fraction    { }            def
  1831. X    /yen        { ($J) map }        def
  1832. X    /florin        { }            def
  1833. X    /section    { (sc) map }        def
  1834. X    /currency    { }            def
  1835. X    /quotesingle    { (fm) (n') mapdup }    def
  1836. X    /quotedblleft    { (lq) map }        def
  1837. X    /guillemotleft    { (d<) map }        def
  1838. X    /guilsinglleft    { (l<) map }        def
  1839. X    /guilsinglright    { (r>) map }        def
  1840. X    /fi        { (fi) cmap }        def
  1841. X    /fl        { (fl) cmap }        def
  1842. X    /endash        { (\\-) map }        def
  1843. X    /dagger        { (dg) map }        def
  1844. X    /daggerdbl    { (dd) map }        def
  1845. X    /periodcentered    { }            def
  1846. X    /paragraph    { (pp) map }        def
  1847. X    /bullet        { (bu) map }        def
  1848. X    /quotesinglbase    { }             def
  1849. X    /quotedblbase    { }            def
  1850. X    /quotedblright    { (rq) map }        def
  1851. X    /guillemotright    { (d>) map }        def
  1852. X    /ellipsis    { }            def
  1853. X    /perthousand    { (pm) cmap }        def
  1854. X    /questiondown    { (I?) map }        def
  1855. X    /grave        { (ga) (\\`) mapdup }    def
  1856. X    /acute        { (aa) (\\') mapdup }    def
  1857. X    /circumflex    { (^) map }        def
  1858. X    /tilde        { (~) map }        def
  1859. X    /macron        { (ma) map }        def
  1860. X    /breve        { (be) map }        def
  1861. X    /dotaccent    { (dt) map }        def
  1862. X    /dieresis    { (..) (um) mapdup }    def
  1863. X    /ring        { (ri) map }        def
  1864. X    /cedilla    { (cd) map }        def
  1865. X    /hungarumlaut    { ('') map }        def
  1866. X    /ogonek        { (og) map }        def
  1867. X    /caron        { (hc) map }        def
  1868. X    /emdash        { (em) map }        def
  1869. X    /AE        { (AE) cmap }        def
  1870. X    /ordfeminine    { }            def
  1871. X    /Lslash        { (PL) map }        def
  1872. X    /Oslash        { (O/) map }        def
  1873. X    /OE        { (OE) cmap }        def
  1874. X    /ordmasculine    { }            def
  1875. X    /ae        { (ae) cmap }        def
  1876. X    /dotlessi    { (ui) map }        def
  1877. X    /lslash        { (Pl) map }        def
  1878. X    /oslash        { (o/) map }        def
  1879. X    /oe        { (oe) cmap }        def
  1880. X    /germandbls    { (ss) map }        def
  1881. Xend
  1882. X
  1883. X/symbol-encoding 189 dict def
  1884. Xsymbol-encoding begin
  1885. X    /space        { space }        def
  1886. X    /exclam        { norm }        def
  1887. X    /universal    { (fa) map }        def
  1888. X    /numbersign    { norm }        def
  1889. X    /existential    { (te) map }        def
  1890. X    /percent    { norm }        def
  1891. X    /ampersand    { norm }        def
  1892. X    /suchthat    { (cm) map }        def
  1893. X    /parenleft    { norm }        def
  1894. X    /parenright    { norm }        def
  1895. X    /asteriskmath    { (**) map }        def
  1896. X    /plus        { (pl) map }        def
  1897. X    /comma        { norm }        def
  1898. X    /minus        { (mi) normdup }    def
  1899. X    /period        { norm }        def
  1900. X    /slash        { (sl) map }        def
  1901. X    /zero        { norm }        def
  1902. X    /one        { norm }        def
  1903. X    /two        { norm }        def
  1904. X    /three        { norm }        def
  1905. X    /four        { norm }        def
  1906. X    /five        { norm }        def
  1907. X    /six        { norm }        def
  1908. X    /seven        { norm }        def
  1909. X    /eight        { norm }        def
  1910. X    /nine        { norm }        def
  1911. X    /colon        { norm }        def
  1912. X    /semicolon    { norm }        def
  1913. X    /less        { norm }        def
  1914. X    /equal        { (eq) normdup }    def
  1915. X    /greater    { norm }        def
  1916. X    /question    { norm }        def
  1917. X    /congruent    { (=~) map }        def
  1918. X    /Alpha        { gnorm }        def
  1919. X    /Beta        { gnorm }        def
  1920. X    /Chi        { (*X) map }        def
  1921. X    /Delta        { gnorm }        def
  1922. X    /Epsilon    { gnorm }        def
  1923. X    /Phi        { gnorm }        def
  1924. X    /Gamma        { gnorm }        def
  1925. X    /Eta        { (*Y) map }        def
  1926. X    /Iota        { gnorm }        def
  1927. X    /theta1        { }            def
  1928. X    /Kappa        { gnorm }        def
  1929. X    /Lambda        { gnorm }        def
  1930. X    /Mu        { gnorm }        def
  1931. X    /Nu        { gnorm }        def
  1932. X    /Omicron    { gnorm }        def
  1933. X    /Pi        { gnorm }        def
  1934. X    /Theta        { (*H) map }        def
  1935. X    /Rho        { gnorm }        def
  1936. X    /Sigma        { gnorm }        def
  1937. X    /Tau        { gnorm }        def
  1938. X    /Upsilon    { gnorm }        def
  1939. X    /sigma1        { (ts) map }        def
  1940. X    /Omega        { (*W) map }        def
  1941. X    /Xi        { (*C) map }        def
  1942. X    /Psi        { (*Q) map }        def
  1943. X    /Zeta        { gnorm }        def
  1944. X    /bracketleft    { norm }        def
  1945. X    /therefore    { (tf) map }        def
  1946. X    /bracketright    { norm }        def
  1947. X    /perpendicular    { (bt) map }        def
  1948. X    /underscore    { (ul) map }        def
  1949. X    /radicalex    { }            def
  1950. X    /alpha        { gnorm }        def
  1951. X    /beta        { gnorm }        def
  1952. X    /chi        { (*x) map }        def
  1953. X    /delta        { gnorm }        def
  1954. X    /epsilon    { gnorm }        def
  1955. X    /phi        { gnorm }        def
  1956. X    /gamma        { gnorm }        def
  1957. X    /eta        { (*y) map }        def
  1958. X    /iota        { gnorm }        def
  1959. X    /phi1        { }            def
  1960. X    /kappa        { gnorm }        def
  1961. X    /lambda        { gnorm }        def
  1962. X    /mu        { gnorm }        def
  1963. X    /nu        { gnorm }        def
  1964. X    /omicron    { gnorm }        def
  1965. X    /pi        { gnorm }        def
  1966. X    /theta        { (*h) map }        def
  1967. X    /rho        { gnorm }        def
  1968. X    /sigma        { gnorm }        def
  1969. X    /tau        { gnorm }        def
  1970. X    /upsilon    { gnorm }        def
  1971. X    /omega1        { }            def
  1972. X    /omega        { (*w) map }        def
  1973. X    /xi        { (*c) map }        def
  1974. X    /psi        { (*q) map }        def
  1975. X    /zeta        { gnorm }        def
  1976. X    /braceleft    { norm }        def
  1977. X    /bar        { (or) normdup }    def
  1978. X    /braceright    { norm }        def
  1979. X    /similar    { (ap) map }        def
  1980. X    /Upsilon1    { }            def
  1981. X    /minute        { (mt) map }        def
  1982. X    /lessequal    { (<=) map }        def
  1983. X    /fraction    { (/) map }        def
  1984. X    /infinity    { (if) map }        def
  1985. X    /florin        { }            def
  1986. X    /club        { (Cc) map }        def
  1987. X    /diamond    { (Cd) map }        def
  1988. X    /heart        { (Ch) map }        def
  1989. X    /spade        { (Cs) map }        def
  1990. X    /arrowboth    { (<>) map }        def
  1991. X    /arrowleft    { (<-) map }        def
  1992. X    /arrowup    { (ua) map }        def
  1993. X    /arrowright    { (->) map }        def
  1994. X    /arrowdown    { (da) map }        def
  1995. X    /degree        { (de) map }        def
  1996. X    /plusminus    { (+-) map }        def
  1997. X    /second        { (sd) map }        def
  1998. X    /greaterequal    { (>=) map }        def
  1999. X    /multiply    { (mu) map }        def
  2000. X    /proportional    { (pt) map }        def
  2001. X    /partialdiff    { (pd) map }        def
  2002. X    /bullet        { }            def
  2003. X    /divide        { (di) map }        def
  2004. X    /notequal    { (!=) map }        def
  2005. X    /equivalence    { (==) map }        def
  2006. X    /approxequal    { (~=) map }        def
  2007. X    /ellipsis    { }            def
  2008. X    /arrowvertex    { }            def
  2009. X    /arrowhorizex    { }            def
  2010. X    /carriagereturn    { (cr) map }        def
  2011. X    /aleph        { (al) map }        def
  2012. X    /Ifraktur    { }            def
  2013. X    /Rfraktur    { }            def
  2014. X    /weierstrass    { }            def
  2015. X    /circlemultiply    { (ax) map }        def
  2016. X    /circleplus    { (a+) map }        def
  2017. X    /emptyset    { (es) map }        def
  2018. X    /intersection    { (ca) map }        def
  2019. X    /union        { (cu) map }        def
  2020. X    /propersuperset    { (sp) map }        def
  2021. X    /reflexsuperset    { (ip) map }        def
  2022. X    /notsubset    { (!s) map }        def
  2023. X    /propersubset    { (sb) map }        def
  2024. X    /reflexsubset    { (ib) map }        def
  2025. X    /element    { (mo) map }        def
  2026. X    /notelement    { (!m) (nm) mapdup }    def
  2027. X    /angle        { (ag) map }        def
  2028. X    /gradient    { (gr) map }        def
  2029. X    /registerserif    { }            def
  2030. X    /copyrightserif    { }            def
  2031. X    /trademarkserif    { }            def
  2032. X    /product    { }            def
  2033. X    /radical    { (sr) map }        def
  2034. X    /dotmath    { (m.) map }        def
  2035. X    /logicalnot    { (no) map }        def
  2036. X    /logicaland    { (an) (la) mapdup }    def
  2037. X    /logicalor    { (lo) map }        def
  2038. X    /arrowdblboth    { (io) map }        def
  2039. X    /arrowdblleft    { (<:) (lh) mapdup }    def
  2040. X    /arrowdblup    { (u=) map }        def
  2041. X    /arrowdblright    { (:>) (rh) (im) mapdupdup } def
  2042. X    /arrowdbldown    { (d=) map }        def
  2043. X    /lozenge    { (dm) map }        def
  2044. X    /angleleft    { (L<) map }        def
  2045. X    /registersans    { (rg) map }        def
  2046. X    /copyrightsans    { (co) map }        def
  2047. X    /trademarksans    { (tm) map }        def
  2048. X    /summation    { }            def
  2049. X    /parenlefttp    { }            def
  2050. X    /parenleftex    { }            def
  2051. X    /parenleftbt    { }            def
  2052. X    /bracketlefttp    { }            def
  2053. X    /bracketleftex    { }            def
  2054. X    /bracketleftbt    { }            def
  2055. X    /bracelefttp    { }            def
  2056. X    /braceleftmid    { }            def
  2057. X    /braceleftbt    { }            def
  2058. X    /braceex    { }            def
  2059. X    /apple        { (AL) map }        def
  2060. X    /angleright    { (R>) map }        def
  2061. X    /integral    { (is) map }        def
  2062. X    /integraltp    { }            def
  2063. X    /integralex    { }            def
  2064. X    /integralbt    { }            def
  2065. X    /parenrighttp    { }            def
  2066. X    /parenrightex    { }            def
  2067. X    /parenrightbt    { }            def
  2068. X    /bracketrighttp    { }            def
  2069. X    /bracketrightex    { }            def
  2070. X    /bracketrightbt    { }            def
  2071. X    /bracerighttp    { }            def
  2072. X    /bracerightmid    { }            def
  2073. X    /bracerightbt    { }            def
  2074. Xend
  2075. XEND
  2076. Xif [ -n "$all" ]
  2077. Xthen
  2078. Xcat <<'END'
  2079. X    /AvantGarde-Demi                /AvantAB     /AB fontinfo
  2080. X    /AvantGarde-DemiOblique         /AvantAI     /AI fontinfo
  2081. X    /AvantGarde-Book                /AvantAR     /AR fontinfo
  2082. X    /AvantGarde-BookOblique         /AvantAX     /AX fontinfo
  2083. X    /Times-Bold                     /Bold        /B  fontinfo
  2084. X    /Bookman-Demi                   /BookB       /BB fontinfo
  2085. X    /Times-BoldItalic               /BoldI       /BI fontinfo
  2086. X    /Bookman-LightItalic            /BookI       /BO fontinfo
  2087. X    /Bookman-Light                  /BookR       /BR fontinfo
  2088. X    /Bookman-DemiItalic             /BookBI      /BX fontinfo
  2089. X    /Courier                        /Courier     /C  fontinfo
  2090. X    /Courier-Bold                   /CourierB    /CB fontinfo
  2091. X    /Courier-Oblique                /CourierO    /CO fontinfo
  2092. X    /Courier-BoldOblique            /CourierBO   /CX fontinfo
  2093. X    /Helvetica                      /Helvetica   /H  fontinfo
  2094. X    /Helvetica-Bold                 /HelvB       /HB fontinfo
  2095. X    /Helvetica-Oblique              /HelvO       /HO fontinfo
  2096. X    /Helvetica-BoldOblique          /HelvBO      /HX fontinfo
  2097. X    /Helvetica-Narrow-Bold          /HelvNarHb   /Hb fontinfo
  2098. X    /Helvetica-Narrow-Oblique       /HelvNarHo   /Hi fontinfo
  2099. X    /Helvetica-Narrow               /HelvNarHn   /Hr fontinfo
  2100. X    /Helvetica-Narrow-BoldOblique   /HelvNarHx   /Hx fontinfo
  2101. X    /Times-Italic                   /Italic      /I  fontinfo
  2102. X    /NewCenturySchlbk-Bold          /NewCB       /NB fontinfo
  2103. X    /NewCenturySchlbk-Italic        /NewCI       /NI fontinfo
  2104. X    /NewCenturySchlbk-Roman         /NewCR       /NR fontinfo
  2105. X    /NewCenturySchlbk-BoldItalic    /NewCX       /NX fontinfo
  2106. X    /Palatino-Bold                  /PalatPB     /PB fontinfo
  2107. X    /Palatino-Italic                /PalatPI     /PI fontinfo
  2108. X    /Palatino-Roman                 /PalatPR     /PR fontinfo
  2109. X    /Palatino-BoldItalic            /PalatPX     /PX fontinfo
  2110. X    /Times-Roman                    /Roman       /R  fontinfo
  2111. X    /Symbol                         /Symbol      /S  fontinfo
  2112. X    /BracketF                       /BracketF    /S2 fontinfo
  2113. X    /ZapfChancery-MediumItalic      /ZapfC       /ZC fontinfo
  2114. X    %    Neither of the next two are likely to work.
  2115. X    /HaeberliWriting                /HaeberliW   /HW fontinfo
  2116. X    /ZapfDingbats                   /ZapfD       /ZD fontinfo
  2117. XEND
  2118. Xelse
  2119. X    if [ -n "$files" ]
  2120. X    then
  2121. X    cat $files
  2122. X    fi
  2123. X    if [ -n "$lines" ]
  2124. X    then
  2125. X    echo $lines
  2126. X    fi
  2127. Xfi
  2128. Xecho "SAVEOBJ restore"
  2129. Xecho "\004\c"
  2130. END_OF_FILE
  2131.   if test 20065 -ne `wc -c <'utils/psdtwd.S'`; then
  2132.     echo shar: \"'utils/psdtwd.S'\" unpacked with wrong size!
  2133.   fi
  2134.   # end of 'utils/psdtwd.S'
  2135. fi
  2136. echo shar: End of archive 4 \(of 19\).
  2137. cp /dev/null ark4isdone
  2138. MISSING=""
  2139. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do
  2140.     if test ! -f ark${I}isdone ; then
  2141.     MISSING="${MISSING} ${I}"
  2142.     fi
  2143. done
  2144. if test "${MISSING}" = "" ; then
  2145.     echo You have unpacked all 19 archives.
  2146.     echo "Read the README to get started with psroff installation"
  2147.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2148. else
  2149.     echo You still must unpack the following archives:
  2150.     echo "        " ${MISSING}
  2151. fi
  2152. exit 0
  2153.  
  2154. exit 0 # Just in case...
  2155.